<template>
	<view>
		<cu-custom bgColor="bg-maincolor" :isBack="true">
			<block slot="content" >
				<text v-if="type==1">学校列表</text>
				<text v-if="type==2">学校管理</text>
			</block>
		</cu-custom>
		<block>
			<view class="sch_box" v-if="type==1&&list!=''">
				<view class="flex box_info" v-for="(item,index) in list"  :key="index"  @tap="to_parctical(item.school_id)"> 
					<view>
						<image :src="item.logo" class="img_box" v-if="item.logo"></image>
						<view class="handName" v-else>{{item.school_name[0]}}</view>
					</view>
					<view class="center_box">
						<view class="shcool_boxtext">{{item.school_name}}</view>
						<view class="information_text">暂无学校描述</view>
					</view>
					<view class="iconfont icon-you1 right_box"></view>
				</view>
			</view>
			<view class="nodata" v-if="list==''">暂无数据</view>
		</block>
		<block>
			<view class="sch_box" v-if="type==2&&list!=''">
				<view class="flex box_info" v-for="(item,index) in listtwo"  :key="index" @tap="to_parctical(item.school_id)"> 
					<view>
						<image :src="item.logo" class="img_box" mode="aspectFill" v-if="item.logo!=''"></image>
						<view v-else class="company_nameBox">{{item.school_name[0]}}</view>
					</view>
					<view class="center_box">
						<view class="shcool_boxtext">{{item.school_name}}</view>
						<view class="information_text">暂无学校描述</view>
					</view>
					<view class="iconfont icon-you1 right_box"></view>
				</view>
			</view>
			<view class="nodata" v-if="list==''">暂无数据</view>
		</block>
	</view>
</template>

<script>
	const {
		appLogin,
		httpGet,
		httpPost
	} = require("@/utils/common.js")
	export default {
		data() {
			return {
				listtwo:[],
				page:1,
				page_size:20,
				list:[],
				type:0
			}
		},
		onLoad(option) {
			appLogin((user_info) => {
				console.log(user_info)
				this.type = option.type
				console.log(this.type)
				console.log(this.type)
				this.getschool_list()
				this.to_patner()
			})
		},
		methods: {
			getschool_list(){
				httpGet({
					url: '/api/school/list',
					data:{
						page:this.page,
						page_size:this.page_size
					},
				}).then(res => {
					console.log(res)
					this.list = res.result.list
					console.log(this.list)
				})
			},
			to_parctical(school_id){
				uni.navigateTo({
					url:'cooperative_school?school_id='+school_id
				})
			},
			to_patner(){
				httpGet({
					url:'/api/company/cooperate_school_list',
					data:{
						page:this.page,
						page_size:this.page_size
					}
				}).then(res => {
					console.log(res,111)
					this.listtwo = res.result.list
				})
			}
		}
	}
</script>

<style>
	.sch_box{
		margin-top: 30rpx;
	}
	
	.box_info{
		border-width: 2rpx;
		border-bottom-style: solid;
		border-color: #e7e7e7;
		height: 175rpx;
		padding-left: 30rpx;
		padding-top: 40rpx;
		background-color: #FFFFFF;
	}
	
	.img_box{
		width: 94rpx;
		height: 94rpx;
		border-radius: 15rpx;
	}
	
	.handName{
		width: 94rpx;
		height: 94rpx;
		border-radius: 15rpx;
		background-color: #0081FF;
		text-align: center;
		line-height: 94rpx;
		color: #FFFFFF;
		font-size: 30rpx;
	}
	
	.center_box{
		margin-left:29rpx;
		margin-top: 5rpx;
	}
	
	.shcool_boxtext{
		color: #333333;
		font-size: 30rpx;
		margin-bottom: 15rpx;
	}
	
	.information_text{
		color: #666666;
		font-size: 27rpx;
	}
	
	.right_box{
		position: absolute;
		right: 34rpx;
		color: #bcbcbc;
		font-size: 28rpx;
		margin-top: 35rpx;
	}
	
	.company_nameBox{
		width: 94rpx;
		height: 94rpx;
		line-height: 94rpx;
		background-color: #007AFF;
		text-align: center;
		border-radius: 90rpx;
		color: #FFFFFF;
		font-size: 30rpx;
	}
	
</style>
